clear
cd "C:\Users\Brian\Dropbox\GIZ Fuel Prices (Andrew, Brian, Johannes)"
use "Diesel_Replication/GasolineDiesel replication data.dta"

replace gas_2000 = gas / deflator_2000
replace diesel_2000 = diesel / deflator_2000
replace gdp_2000 = gdp / deflator_2000
replace gdppc_2000 = gdppc / deflator_2000
replace log_gdppc = log(gdppc_2000)
replace oilprice_2000 = oilprice / deflator_2000
replace log_gdp_2000 = log(gdp_2000)

gen diesel_share = diesel_consump / (diesel_consump + gasoline_consump) if year==1990
bys country: egen max_diesel_share = max(diesel_share)

gen t = 0 if year == 1991
replace t = 1 if year == 1992
replace t = 2 if year == 1995
replace t = 3 if year == 1998
replace t = 4 if year == 2000
replace t = 5 if year == 2002
replace t = 6 if year == 2004
replace t = 7 if year == 2006
replace t = 8 if year == 2008
replace t = 9 if year == 2010
replace t = 10 if year == 2012

egen id = group(country)
drop if t == .

xtset id t

gen gas_orig = gas_2000
gen diesel_orig = diesel_2000

gen log_gdp_2005 = log(gdp_2005)
gen log_oilprod = log(oilprod + 1)

gen NOC_total_crises = NOC * total_crises
gen NOC_oilprice = NOC * oilprice_2000

gen t2 = t^2
gen t3 = t^3

replace gas_2000 = L1.gas_2000 if year == 1992 & gas_orig == .
replace gas_2000 = F1.gas_2000 if year == 1991 & gas_orig == .
replace gas_2000 = (L1.gas_2000 + gas_2000)/2 if year == 1992

replace diesel_2000 = L1.diesel_2000 if year == 1992 & diesel_orig == .
replace diesel_2000 = F1.diesel_2000 if year == 1991 & diesel_orig == .
replace diesel_2000 = (L1.diesel_2000 + diesel_2000)/2 if year == 1992

*** OTHERS

foreach var of varlist NOC_oilprice log_gdp_2000 log_gdppc polity2 bureauc log_oilprod trade_pctgdp pop_urb_pct imf_prog consumer_inflat diesel_consump gasoline_consump nra_covt rra agri_land rural_land{
replace `var' = L1.`var' if year == 1992 & `var' == .
replace `var' = F1.`var' if year == 1991 & `var' == .
replace `var' = (L1.`var' + `var')/2 if year == 1992
}

*** NOW DROP 1991

drop if year == 1991

*Correlation between oil price and fuel price
pwcorr gas_2000 diesel_2000 oilprice_2000 if NOC==1, sig star(.05) obs
pwcorr gas_2000 diesel_2000 oilprice_2000 if NOC==0, sig star(.05) obs
pwcorr gas_2000 diesel_2000 oilprice_2000, sig star(.05) obs
label variable gas_2000 "Gas price"
label variable diesel_2000 "Diesel price"
label variable oilprice_2000 "Oil price"

***Creating country-year-fuel unit of analysis
gen gas_diesel = gas_2000 / diesel_2000
rename diesel_2000 fuel1
rename gas_2000 fuel2
gen gas_2000 = fuel2
gen diesel_2000 = fuel1
label variable gas_2000 "Gas price"
label variable diesel_2000 "Diesel price"
reshape long fuel, i(country year) j(fuel_id)
replace fuel = fuel*100
gen log_fuel = log(fuel)
gen fuel_id2 = 1
replace fuel_id2 = 2 if fuel_id==2
drop fuel_id
rename fuel_id2 fuel_id
replace fuel_id = 0 if fuel_id==1
replace fuel_id = 1 if fuel_id==2
label variable fuel_id "Gasoline"
order fuel_id, after(year)
order fuel, after(fuel_id)
order log_fuel, after(fuel)
label variable fuel "Fuel price (constant 2000 US cents per liter)"
label variable log_fuel "Price (log)"
label variable diesel_consump "Diesel consumption (thousand barrels per day)"
label variable gasoline_consump "Gasoline consumption (thousand barrels per day)"
gen log_oil = log(oilprice_2000)
gen oil_fuelid = log_oil * fuel_id
gen NOC_oil_fuelid = log_oil * NOC * fuel_id
gen NOC_oil = NOC * log_oil
gen NOC_fuelid = NOC * fuel_id
gen top10 = 0
replace top10 = 1 if country=="Iran, Islamic Rep." | country=="Syrian Arab Republic" | country=="Egypt, Arab Rep." | country=="Yemen, Rep." | country=="Jordan" | country=="Sri Lanka" | country=="Saudi Arabia" | country=="Venezuela, RB" | country=="Algeria" | country=="Eritrea"
label variable log_gdp_2000 "GDP, 2000 USD (log)"
label variable log_gdppc "GDPpc, 2000 USD (log)"
label variable log_pop "Population (log)"
label variable oilprice_2000 "Oil price, 2000 USD"
label variable pop_urb_pct "\% urban population"
label variable bureauc_quality "Bureaucratic quality"
label variable landlocked "Landlocked"
label variable imf_prog "IMF program"
label variable trade_pctgdp "Trade (\% of GDP)"
label variable polity2 "Polity"
label variable opec "OPEC"
label variable log_oil "Oil price (log)"
label variable NOC_oil_fuelid "NOC * Oil price (log) * Gas"
label variable NOC_fuelid "NOC * Gas"
label variable NOC_oil "NOC * Oil price (log)"
label variable oil_fuelid "Oil price (log) * Gas"
label variable ross_majpro_lt "Major oil producer"
label variable nra_covt "Rural bias"
label variable rra "Rural bias"
label variable agri_land "Agricultural land (\%)"
label variable rural_land "Rural land (\%)"
label variable consumer_inflat "Consumer inflation (\%)"
tabulate id, gen(countrydum)

gen bias_fuelid = rra * fuel_id
gen agri_fuelid = agri * fuel_id
gen rural_fuelid = rural * fuel_id
label variable bias_fuelid "Rural bias * Gasoline"
label variable rural_fuelid "Rural land * Gasoline"
label variable agri_fuelid "Agricultural land * Gasoline"

gen bias_fuelid_NOC = rra * fuel_id * NOC
gen bias_fuelid_oil = rra * fuel_id * log_oil
gen bias_oil = rra * log_oil
label variable bias_fuelid_NOC "Rural bias * Gas * NOC"
label variable bias_fuelid_oil "Rural bias * Gas * Oil price (log)"
label variable bias_oil "Rural bias * Oil price (log)"

gen democracy = 0
replace democracy = 1 if polity2 > 5 & polity2 != .
gen oil_fuelid_democ = log_oil * fuel_id * democracy
gen NOC_oil_fuelid_democ = log_oil * NOC * fuel_id * democracy
gen NOC_oil_democ = NOC * log_oil * democracy
gen NOC_democ = NOC * democracy
gen oil_democ = log_oil * democracy
gen democ_fuelid = democracy * fuel_id
label variable NOC_oil_fuelid_democ "NOC * Oil price (log) * Gasoline * Democracy"
label variable oil_fuelid_democ "Oil price (log) * Gasoline * Democ"
label variable NOC_democ "NOC * Democracy"
label variable oil_democ "Oil price (log) * Democ"
label variable democ_fuelid "Gas * Democ"
label variable democracy "Democracy"


sort country
by country: egen mean_gasdiesel = mean(gas_diesel)
by country: egen mean_NOC = mean(NOC)
by country: egen mean_bureauc = mean(bureauc)
by country: egen mean_pop = mean(log_pop)
by country: egen mean_polity2 = mean(polity2)
by country: egen mean_democracy = mean(democracy)
by country: egen mean_urban = mean(pop_urb_pct)
by country: egen mean_tradepctgdp = mean(trade_pctgdp)
by country: egen mean_opec = mean(opec)
by country: egen mean_gdppc = mean(log_gdppc)
by country: egen mean_rra = mean(rra)
label variable mean_gasdiesel "Gas/Diesel Ratio (country mean)"
label variable mean_NOC "NOC (country mean)"
label variable mean_bureauc "Bureaucratic quality (country mean)"
label variable mean_pop "Population (log) (country mean)"
label variable mean_polity2 "Polity (country mean)"
label variable mean_urban "Urban population (\%) (country mean)"
label variable mean_tradepctgdp "Trade (\% of GDP) (country mean)"
label variable mean_opec "OPEC (country mean)"
label variable mean_gdppc "GDPpc (country mean)"
label variable mean_rra "Rural bias (country mean)"
label variable mean_democracy "Democracy (country mean)"



***TABLE 1***
reg log_fuel oil_fuelid fuel_id log_oil NOC countrydum*, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC countrydum*, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC countrydum* t t2 t3, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, cluster(id)
reg log_fuel oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)

***TABLE A1***
label variable nra_covt "Rural bias"
sutex log_fuel NOC_oil_fuelid NOC_oil oil_fuelid log_oil mean_gasdiesel NOC ross_majpro_lt mean_NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc imf_prog consumer_inflat nra_covt, labels nobs minmax

***TABLE A2***
pwcorr gas_2000 diesel_2000 oilprice_2000

***TABLE A3***
gen log_gas = log(gas_2000)
gen log_diesel = log(diesel_2000)
pwcorr NOC ross_majpro_lt log_gas log_diesel

***TABLE A4***
list country year gas_diesel if gas_diesel > 2.5 & gas_diesel != .

***TABLE A5***
list country year polity2 ross_majpro_lt pop_urb_pct rra max_diesel_share if country=="Nigeria" | country=="Sri Lanka" | country=="Iran, Islamic Rep." | country=="Jordan" | country=="Kuwait" | country=="Turkey"

***TABLE A6***
sort id t
by id: gen lag_log_fuel = log_fuel[_n-2]
order lag_log_fuel, after(log_fuel)
label variable lag_log_fuel "Fuel price (log)"

reg log_fuel lag_log_fuel oil_fuelid log_oil NOC fuel_id, cluster(id)
reg log_fuel lag_log_fuel NOC_oil_fuelid NOC_oil oil_fuelid log_oil NOC fuel_id NOC_fuelid, cluster(id)
reg log_fuel lag_log_fuel NOC_oil_fuelid NOC_oil oil_fuelid log_oil NOC fuel_id NOC_fuelid t t2 t3, cluster(id)
reg log_fuel lag_log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp t t2 t3, cluster(id)
reg log_fuel lag_log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc t t2 t3, cluster(id)
reg log_fuel lag_log_fuel oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc t t2 t3, cluster(id)

***TABLE A7***
reg log_fuel log_oil NOC countrydum* if fuel_id==0, cluster(id)
reg log_fuel log_oil NOC_oil NOC countrydum* if fuel_id==0, cluster(id)
reg log_fuel log_oil NOC_oil NOC countrydum* t t2 t3 if fuel_id==0, cluster(id)
reg log_fuel log_oil log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp NOC_oil NOC countrydum* t t2 t3 if fuel_id==0, cluster(id)
reg log_fuel log_oil log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp NOC_oil NOC bureauc countrydum* t t2 t3 if fuel_id==0, cluster(id)
reg log_fuel log_oil log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp NOC bureauc countrydum* t t2 t3 if fuel_id==0, cluster(id)

***TABLE A8***
reg log_fuel log_oil NOC countrydum* if fuel_id==1, cluster(id)
reg log_fuel log_oil NOC_oil NOC countrydum* if fuel_id==1, cluster(id)
reg log_fuel log_oil NOC_oil NOC countrydum* t t2 t3 if fuel_id==1, cluster(id)
reg log_fuel log_oil log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp NOC_oil NOC countrydum* t t2 t3 if fuel_id==1, cluster(id)
reg log_fuel log_oil log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp NOC_oil NOC bureauc countrydum* t t2 t3 if fuel_id==1, cluster(id)
reg log_fuel log_oil log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp NOC bureauc countrydum* t t2 t3 if fuel_id==1, cluster(id)

***TABLE A9***
reg log_fuel oil_fuelid fuel_id log_oil NOC countrydum* if ross_majpro_lt==0, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC countrydum* if ross_majpro_lt==0, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC countrydum* t t2 t3 if ross_majpro_lt==0, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3 if ross_majpro_lt==0, cluster(id)
reg log_fuel oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if ross_majpro_lt==0, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if ross_majpro_lt==0, cluster(id)


***TABLE A10***
reg log_fuel oil_fuelid fuel_id log_oil NOC countrydum* if ross_majpro_lt==1, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC countrydum* if ross_majpro_lt==1, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC countrydum* t t2 t3 if ross_majpro_lt==1, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3 if ross_majpro_lt==1, cluster(id)
reg log_fuel oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if ross_majpro_lt==1, cluster(id)
reg log_fuel NOC_oil_fuelid NOC_oil oil_fuelid fuel_id NOC_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if ross_majpro_lt==1, cluster(id)

***TABLE A11***
reg log_fuel fuel_id oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc imf_prog consumer_inflat i.id t t2 t3, cluster(id)
reg log_fuel fuel_id oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc i.id t t2 t3 if gas_diesel < 2, cluster(id)
reg log_fuel fuel_id oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc i.id t t2 t3 if oecd==0, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc imf_prog consumer_inflat i.id t t2 t3, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc i.id t t2 t3 if gas_diesel < 2, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc i.id t t2 t3 if oecd==0, cluster(id)

***TABLE A12***
replace NOC = 0 if country=="Austria"
replace NOC = 0 if country=="Croatia"
replace NOC = 0 if country=="Denmark"
replace NOC = 0 if country=="Gabon"
replace NOC = 0 if country=="Hungary"
replace NOC = 0 if country=="Myanmar"
replace NOC = 0 if country=="Poland"
replace NOC = 0 if country=="Portugal"
replace NOC = 0 if country=="Sri Lanka"
replace NOC = 0 if country=="Uruguay"

drop NOC_oil_fuelid
drop NOC_oil
drop NOC_fuelid
gen NOC_oil_fuelid = log_oil * NOC * fuel_id
gen NOC_oil = NOC * log_oil
gen NOC_fuelid = NOC * fuel_id
label variable NOC_oil_fuelid "NOC * Oil price (log) * Gas"
label variable NOC_fuelid "NOC * Gas"
label variable NOC_oil "NOC * Oil price (log)"

reg log_fuel fuel_id oil_fuelid log_oil NOC countrydum*, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC countrydum*, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC countrydum* t t2 t3, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)
reg log_fuel fuel_id oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)


***TABLE A13***
replace NOC = 0 if country=="Portugal"
replace NOC = 0 if country=="Sri Lanka"
replace NOC = 0 if country=="Peru"
replace NOC = 1 if country=="Cuba" & year > 1984
replace NOC = 1 if country=="Greece" & year > 1997
replace NOC = 1 if country=="Jordan" & year > 1994 
replace NOC = 1 if country=="Slovak Republic" & year > 1910
replace NOC = 1 if country=="Suriname" & year > 1979

drop NOC_oil_fuelid
drop NOC_oil
drop NOC_fuelid
gen NOC_oil_fuelid = log_oil * NOC * fuel_id
gen NOC_oil = NOC * log_oil
gen NOC_fuelid = NOC * fuel_id
label variable NOC_oil_fuelid "NOC * Oil price (log) * Gas"
label variable NOC_fuelid "NOC * Gas"
label variable NOC_oil "NOC * Oil price (log)"

reg log_fuel fuel_id oil_fuelid log_oil NOC countrydum*, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC countrydum*, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC countrydum* t t2 t3, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, cluster(id)
reg log_fuel NOC_oil_fuelid fuel_id NOC_fuelid NOC_oil oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)
reg log_fuel fuel_id oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)

***TABLE A14***
label variable gas_diesel "Gas/Diesel Ratio"
reg gas_diesel log_oil NOC countrydum* if fuel_id==0, cluster(id)
reg gas_diesel NOC_oil log_oil NOC countrydum* if fuel_id==0, cluster(id)
reg gas_diesel NOC_oil log_oil NOC countrydum* t t2 t3 if fuel_id==0, cluster(id)
reg gas_diesel NOC_oil log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3 if fuel_id==0, cluster(id)
reg gas_diesel log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if fuel_id==0, cluster(id)
reg gas_diesel NOC_oil log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if fuel_id==0, cluster(id)

***TABLE A15***
reg log_fuel oil_fuelid log_oil rra bias_fuelid bias_oil fuel_id NOC countrydum* t t2 t3, cluster(id)
reg log_fuel oil_fuelid log_oil rra bias_fuelid bias_oil fuel_id bias_fuelid_oil NOC countrydum* t t2 t3, cluster(id)
reg log_fuel oil_fuelid log_oil rra bias_fuelid bias_oil fuel_id bias_fuelid_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, cluster(id)
reg log_fuel oil_fuelid log_oil rra bias_fuelid bias_oil fuel_id bias_fuelid_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)

***TABLE A16***
reg log_fuel oil_fuelid log_oil fuel_id NOC countrydum* if democracy==1, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil countrydum* if democracy==1, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil countrydum* t t2 t3 if democracy==1, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil log_pop log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3 if democracy==1, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil log_pop log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if democracy==1, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC log_pop log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if democracy==1, cluster(id)

***TABLE A17***
reg log_fuel oil_fuelid log_oil fuel_id NOC countrydum* if democracy==0, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil countrydum* if democracy==0, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil countrydum* t t2 t3 if democracy==0, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil log_pop log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3 if democracy==0, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC_fuelid NOC NOC_oil log_pop log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if democracy==0, cluster(id)
reg log_fuel oil_fuelid log_oil fuel_id NOC log_pop log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3 if democracy==0, cluster(id)

***TABLE A18***
reg log_fuel oil_fuelid log_oil democracy democ_fuelid fuel_id oil_democ NOC countrydum* t t2 t3, cluster(id)
reg log_fuel oil_fuelid log_oil democracy democ_fuelid fuel_id oil_democ oil_fuelid_democ NOC countrydum* t t2 t3, cluster(id)
reg log_fuel oil_fuelid log_oil democracy democ_fuelid fuel_id oil_democ oil_fuelid_democ NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, cluster(id)
reg log_fuel oil_fuelid log_oil democracy democ_fuelid fuel_id oil_democ oil_fuelid_democ NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)

***TABLE A19***
gen share_oil_fuelid = log_oil * max_diesel_share * fuel_id
gen share_oil = max_diesel_share * log_oil
gen share_fuelid = max_diesel_share * fuel_id
label variable share_oil_fuelid "Diesel share * Oil price (log) * Gas"
label variable share_fuelid "Diesel share * Gas"
label variable share_oil "Diesel share * Oil price (log)"
reg log_fuel share_fuelid share_oil oil_fuelid fuel_id log_oil NOC countrydum*, cluster(id)
reg log_fuel share_oil_fuelid share_fuelid share_oil oil_fuelid fuel_id log_oil NOC countrydum*, cluster(id)
reg log_fuel share_fuelid share_oil oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, cluster(id)
reg log_fuel share_oil_fuelid share_fuelid share_oil oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, cluster(id)
reg log_fuel share_fuelid share_oil oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)
reg log_fuel share_oil_fuelid share_fuelid share_oil oil_fuelid fuel_id log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp bureauc countrydum* t t2 t3, cluster(id)



***FIGURE 1***
sort year
by year: egen noNOC_gas = mean(fuel) if NOC==0 & fuel_id==2
by year: egen noNOC_diesel = mean(fuel) if NOC==0 & fuel_id==1
by year: egen NOC_gas = mean(fuel) if NOC==1 & fuel_id==2
by year: egen NOC_diesel = mean(fuel) if NOC==1 & fuel_id==1
gen oil_cents = oilprice_2000 * 100
graph twoway (scatter noNOC_gas t, connect(l) clpattern(dash)) (scatter NOC_gas t, connect(l) clpattern(dash)) (scatter oilprice_2000 t, connect(l) clpattern(dot)), xmtick(1(1)10) scheme(s2mono) graphregion(fcolor(white)) ytitle("Constant 2000 price") xtitle("Year") title("Average gasoline price over time") xlabel(1 "1992" 2 "1995" 3 "1998" 4 "2000" 5 "2002" 6 "2004" 7 "2006" 8 "2008" 9 "2010" 10 "2012") legend(label(1 "Gas, No NOC (cents)") label(2 "Gas, NOC (cents)") label(3 "Oil price (dollars)"))
graph twoway (scatter noNOC_diesel t, connect(l)) (scatter NOC_diesel t, connect(l)) (scatter oilprice_2000 t, connect(l) clpattern(dot)), xmtick(1(1)10) scheme(s2mono) graphregion(fcolor(white)) ytitle("Constant 2000 price") xtitle("Year") title("Average diesel price over time") xlabel(1 "1992" 2 "1995" 3 "1998" 4 "2000" 5 "2002" 6 "2004" 7 "2006" 8 "2008" 9 "2010" 10 "2012") legend(label(1 "Diesel, No NOC (cents)") label(2 "Diesel, NOC (cents)") label(3 "Oil price (dollars)"))

***FIGURE A2***
estsimp reg log_fuel fuel_id oil_fuelid log_oil NOC log_pop polity2 log_gdppc pop_urb_pct trade_pctgdp countrydum* t t2 t3, robust
setx mean
setx countrydum* 0
setx countrydum2 1
*Fuel type = diesel
setx oil_fuelid 0
setx fuel_id 0
setx log_oil 1.711
simqi, pv

setx log_oil 2.332
simqi, pv

setx log_oil 2.953
simqi, pv

setx log_oil 3.574
simqi, pv

setx log_oil 4.195
simqi, pv

setx log_oil 4.816
simqi, pv

setx log_oil 5.437
simqi, pv

*Fuel type = gasoline
setx fuel_id 1
setx oil_fuelid 1.711
setx log_oil 1.711
simqi, pv

setx log_oil 2.332
setx oil_fuelid 2.332
simqi, pv

setx oil_fuelid 2.953
setx log_oil 2.953
simqi, pv

setx oil_fuelid 3.574
setx log_oil 3.574
simqi, pv

setx oil_fuelid 4.195
setx log_oil 4.195
simqi, pv

setx oil_fuelid 4.816
setx log_oil 4.816
simqi, pv

setx oil_fuelid 5.437
setx log_oil 5.437
simqi, pv

